/*
 * @Descripttion: 
 * @version: 
 * @Author: TT
 * @Date: 2023-10-25 10:03:12
 * @LastEditors: TT
 * @LastEditTime: 2023-10-28 11:38:38
 */
import 'package:flutter/material.dart';
import 'package:hzy_project_template/base_ui_config/base_ui_config_index.dart';
import 'package:hzy_project_template/commpontents/commpontents_index.dart';
import 'package:hzy_project_template/config/config_index.dart';
import 'package:hzy_project_template/utils/utils_index.dart';
import 'package:permission_handler/permission_handler.dart';

class NormalNoPerWidget extends CommonLessWidget {
  const NormalNoPerWidget({
    super.key,
    this.type = 0,
  });

  final int type;

  @override
  Widget createBody({
    required BuildContext context,
    BoxConstraints? constraints,
  }) {
    Widget body = Column(
      mainAxisAlignment: MainAxisAlignment.spaceBetween,
      children: [
        Column(
          children: [
            Gaps.vGap50,
            configTitleWidget(),
            Gaps.vGap15,
            configMsgWidget(),
          ],
        ),
        configOpenSettingWidget(),
      ],
    );
    body = Padding(
      padding: const EdgeInsets.all(40),
      child: body,
    );

    body = Stack(
      children: [
        body,
        createNormalCloseBtnWidget(
          iconColor: Colors.white,
        ),
      ],
    );

    return body;
  }

  configTitleWidget() {
    Widget body = Text(
      type == 0 ? NoteLauncIdConfig.noPerAlbumMsg.tr : "",
      style: HzyTextStyle.fontBold(
        size: 20.w,
        color: popToolWColor,
      ),
    );
    return body;
  }

  configMsgWidget() {
    Widget body = Text(
      type == 0 ? NoteLauncIdConfig.noPerAlbumTitle.tr : "",
      style: HzyTextStyle.fontMedium(
        size: 16.w,
        color: popToolWColor,
      ),
      textAlign: TextAlign.center,
    );
    return body;
  }

  configOpenSettingWidget() {
    Widget body = HzyBtnWidget(
      text: NoteLauncIdConfig.openSettings.tr,
      fontColor: Colors.white,
      height: 50,
      textStyle: HzyTextStyle.fontBold(
        size: 16.w,
        color: Colors.white,
      ),
      borderRadius: BorderRadius.circular(10.r),
      bgColor: HzyCommonColor().colthemes,
      tapCall: () async {
        openAppSettings();
      },
    );
    return body;
  }
}
